{% extends "../main.html" %}
{% block nem %}
<ul class="nav nav-sidebar">
    <li><a href="/hosts">主机管理</a></li>
    <li><a href="/hosts/add">添加</a></li>
    <li class="active"><a href="">更新</a></li>

</ul>
{% end %}
{% block bodyy %}
<h3 class="sub-header" content="">更新主机</h3>
<div class="panel-body">
    <form class="form-horizontal" method="post" action="/hosts/update">
        <div class="form-group">
            <label class="col-sm-2 control-label">主机ID</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="主机ID" name="id" value={{data[0][0]}}
                       readOnly="true">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">主机IP</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="主机IP地址" name="hip" value="{{data[0][1]}}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">主机端口</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="主机端口:0~65535" name="hport"
                       value={{data[0][3]}}>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">主机用户</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" placeholder="主机用户" name="huser" value="{{data[0][4]}}">
            </div>
        </div>
        <div class="form-group">
            <label for="inputPassword3" class="col-sm-2 control-label">主机密码</label>
            <div class="col-sm-10">
                <input type="password" class="form-control" id="inputPassword3" placeholder="密码" name="hpasswd"
                       value="{{data[0][5]}}">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">主机组</label>
            <div class="col-sm-10">
                <select id="sel_menu" class="form-control" name="hgroup">
                    {% for i in data2 %}
                    {%if data[0][2]!=i[0]%}
                    <option value="{{i[0]}}">{{i[1]}}</option>
                    {%else%}
                    <option value="{{i[0]}}" selected>{{i[1]}}</option>
                    {%end%}
                    {% end %}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">主机状态</label>
            <div class="col-sm-10">
                <select id="sel_menu" class="form-control" name="hstatus">
                    {% if data[0][6]==1 %}
                    <option value="1" selected>正常</option>
                    <option value="0">停用</option>
                    {% else %}
                    <option value="1">正常</option>
                    <option value="0" selected>停用</option>
                    {% end %}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">监控状态</label>
            <div class="col-sm-10">
                <select id="sel_menu" class="form-control" name="monit">
                    {% if data[0][7]==1 %}
                    <option value="1" selected>开启监控</option>
                    <option value="0">关闭监控</option>
                    {% else %}
                    <option value="1">开启监控</option>
                    <option value="0" selected>关闭监控</option>
                    {% end %}
                </select>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-5 col-sm-10">
                <button type="submit" class="btn btn-primary" name="cmd" value="update">更新</button>
                <a type="button" href="/hosts" class="btn btn-danger">取消</a>
                <!--<button type="submit" class="btn btn-danger" name="cmd" value="add">提交-新增</button>-->
            </div>
        </div>
    </form>
</div>
{% end %}

